CC := g++
INCLUDE_OPENCV = $(shell pkg-config --cflags opencv4)
LIBS_OPENCV = $(shell pkg-config --libs opencv4) -lm 

INC_DIR := ./inc
SRC_DIR := ./src
USR_DIR := ./usr
OBJ_DIR := ./obj

SRC_FILE := $(notdir $(wildcard $(SRC_DIR)/*.cpp))
USR_FILE := $(notdir $(wildcard $(USR_DIR)/*.cpp))
OBJ_FILE := $(patsubst %.cpp,$(OBJ_DIR)/%.o,$(SRC_FILE) $(USR_FILE))


VPATH := ./usr ./src 
 
TARGET := main
 
all:$(TARGET)
 
 
$(TARGET):$(OBJ_FILE)	
	$(CC) -o $@ $^ $(INCLUDE_OPENCV) $(LIBS_OPENCV) 
 
 
$(OBJ_DIR)/%.o:%.cpp
	$(CC) -c $< -o $@ -I $(INC_DIR) $(INCLUDE_OPENCV) $(LIBS_OPENCV)  

echo:
	echo USR_FILE:$(USR_FILE)
	echo SRC_FILE:$(SRC_FILE)
	echo OBJ_FILE:$(OBJ_FILE)
 
clean:
	rm -f $(OBJ_FILE)
	rm -f $(TARGET)
	rm -f ./TXT/*
picture:
	rm -f ./Picture/*
